<template>
  <div>
    <div v-if="splList.length>0">
      <el-radio v-model="selectedspl" :label="item.hash.id" border style="display:block;margin:10px 0"
        v-for="(item, index) in splList" :key="index" @change="postspl"
      >{{item.hash.approval_username.replace(/,/g," - ")}}( {{item.hash.fname}} )</el-radio>
    </div>
    <div v-else style="color:#aaa">
      暂无审批流
    </div>
  </div>

</template>

<script>
export default {
  data() {
    return {
      splList: [],
      selectedspl: '',
      ts: this.newStore(),
    };
  },
  props: {
    atypeid: String,
    num: Number,
  },
  created() {
    console.log(this.num);

    this.getsplList();
  },
  methods: {
    postspl() {
      this.$emit('getsplid', this.selectedspl);
    },
    // 获取审批流列表
    getsplList() {
      const req = {
        handle: '9000B8B8D347526960C5BAB1FB6894EF7C48DC21B3716A54CD3A43E9777C4E90',
        orgid: localStorage.getItem('dept'),
        ftype: this.atypeid,
        number: this.num,
      };
      this.spost(this.ts, '/mainservlet', req)
        .then((ts) => {
          // console.log(ts.d);
          this.splList = ts.d.data.operation1;
        });
    },
  },
};
</script>

<style>

</style>
